Skip to content

fix(plugin-form): the default ObjectForm edit of a record that does not exist shows the not-found state, not an empty editable form - #29417

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-4d2jbw
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-4d2jbw

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #29354

Clause-②: no
Metadata-protocol: none

Declarations as set by the claim (card comment 6578598549), which fixes the file surface: ObjectForm.tsx, loadFailure.ts only for a small extension of its helper, their tests and a root changeset.

维护者速读

What changes

  • A null edit read is a failure, not a record, in the default layout too. DataSource.findOne is typed T | null, and the ObjectStack adapter's readOne answers null when the server answers 404. SimpleObjectForm (the default object-form arm) passed that answer straight to snapshotLoadedRecord and setInitialData and committed the read, so an edit form for a deleted or unknown record drew a blank editable form with an enabled Update button. It now fails the record read with the package-private RecordNotFoundError, through the per-read failure run every other load failure uses, and neither seeds the form nor takes a save baseline. This is the branch the four other record layouts already take.
  • The same drawing. When the shown load failure is a RecordNotFoundError, the layout returns the shared private RecordNotFoundState (test id simple-form-record-not-found) ahead of the generic "Error loading form" box. That early return is the one that already kept the form, its footer and its submit off screen for any load failure.
  • Also on a background re-read. A bus re-read (useRecordInvalidation) that finds the record deleted while the form is open shows the same state, as in the drawer, tabbed and wizard layouts. A later re-read that finds the record again commits and takes the screen back, as for any record read failure.
  • Unchanged. Create (or no id) never reads; inline-field forms never read; an edit of a record that exists draws its form as before. No new string, no new export from the package entry, no prop or schema change.
  • loadFailure.ts: one JSDoc line now names ObjectForm's default arm among the callers of RecordNotFoundState (comment only; the seat confirmed it is inside the claimed surface).

Why

A user who opens an old link to a deleted record in the default object form saw a blank form, filled it in, and learned the record did not exist only on save.

Tests

  • New ObjectForm.recordNotFound-29354.test.tsx, one describe.each over the flat and the sectioned render paths of ObjectForm (no formType, so the default arm, with the real registered fields): a null read draws "Record not found", its description and the simple-form-record-not-found test id, with no title input, no Update button and no "Error loading form"; a found record that a bus re-read then finds deleted switches to the same state; CONTROL a found record still draws its form and Update; CONTROL a create draws an empty form with Create and never calls findOne.

Acceptance notes

  • Live console not measured. The chain is pinned in vitest from the findOne answer down; the adapter's 404 to null mapping is read from ObjectStackAdapter.readOne, not re-exercised, and no Console route that mounts the default layout for an edit was driven.
  • After a not-found re-read the save baseline is left as it was (loadedRecordRef), as in the other layouts: nothing can save while the not-found state is drawn, and the next successful read replaces it.

Verification

New pin · 8/8 here; the 4 not-found cases red with the null check dropped

pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/src/ObjectForm.recordNotFound-29354.test.tsx packages/plugin-form/src/recordNotFound-29247.test.tsx packages/plugin-form/src/ModalForm.recordNotFound-29157.test.tsx under os-verify-lock at 47103058: Test Files 3 passed (3), Tests 24 passed (24).

Ablation 1 at bde6a7fa (drop the null check only): node scripts/ablation-replace.mjs replaced the anchor if (data == null) { (followed by the run.fail(new RecordNotFoundError line) with if (data == null && false) {, anchor 1 to 0, blob 9076fe06c494 to 53ebc1eb3468. New test file alone: Tests 4 failed, 4 passed (8). The four failures are the two not-found cases on each render path, each "Unable to find an element with the text: Record not found"; the four CONTROLs passed. The tool restored the file: blob equal to HEAD 9076fe06c494, git diff HEAD empty.

Ablation 2 at bde6a7fa (whole fix out): ObjectForm.tsx restored from the base b7720782 with git restore --source (on disk: RecordNotFoundError count 0, if (data == null) count 0), loadFailure.ts kept at HEAD: the same 4 failed, 4 passed. Restored with git restore --source=HEAD --staged --worktree under an EXIT trap; git hash-object equal to the HEAD blob, git diff HEAD empty, git status --porcelain empty.

At the final head 53e0b949 (after merging main at 7f277a86, which touched no plugin-form file): the closure rebuilt (47 tasks), then the three not-found files plus ObjectForm.test.tsx and ObjectForm.invalidationRefetch-10572.test.tsx: Test Files 5 passed (5), Tests 37 passed (37).

plugin-form package, type check and lint
  • pnpm --dir ui exec vitest run --maxWorkers=2 over all 222 plugin-form test files in three locked batches at bde6a7fa: 74 files / 485 tests, 67 files / 699 tests, 81 files / 1263 passed + 1 skipped. Total 222 files passed, 2447 passed, 1 skipped.
  • turbo run type-check --filter=@object-ui/plugin-form (tsc --noEmit && tsc -p tsconfig.test.json; the test project lists the new file): exit 0 at bde6a7fa, 47103058 and 53e0b949.
  • eslint on the three changed .ts/.tsx files: 0 errors; the new test has no warning (its schema is typed as ObjectFormComponentProps['schema'], not any).
  • pnpm --dir ui run check:new-line-citations: 0 new citations.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 34 commands, the same 34 against merge bases b7720782 and 7f277a86. The 33 non-vitest gates ran in one loop starting at bde6a7fa and all exited 0, check-sdui-manifest.mjs and its --self-test, check:nul-bytes, check:query-options-erasure, check:type-check-debt and check:test-source-alias among them; pnpm --dir ui exec vitest run scripts/ at 47103058: Test Files 169 passed, 2 skipped; Tests 4921 passed, 2 skipped. dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED.

At the final head 53e0b949: check-sdui-manifest, check-changeset-no-major, check-adr-0087-registration, check-empty-changeset, check:nul-bytes, check:cross-package-test-inputs, check:test-source-alias, check:undeclared-dep-imports, check:type-check-debt, check:type-check-coverage and check:published-files all exit 0. The other 22 derived gates were last measured from bde6a7fa on; the commits since change one test line's cast and merge main.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (no spec change)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (eslint on the changed files: 0 errors)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

…he not-found state

A null findOne answer in edit mode now fails the record read with
RecordNotFoundError and draws the shared RecordNotFoundState, as the
modal, drawer, tabbed and wizard layouts already do, instead of seeding
a blank editable form.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
…t a missing one

An edit form now draws the record not-found state for a null read, so
the control case answers an empty record for its own id to keep a
surface with controls and no fixture values behind it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m

席位核对 · ACCEPT · 2026-11-02T15:02Z

Head-sha: 86d9bc9cbf99cefbdbb96917a6c5d473e5747c15

  • Shape: draft → main, Fixes #29354 in the body only. 5 files, +178 / −7 (185 lines ≤ 3000). No governed path: check-governed-merges --pr 29417 reports NOT governed. Clause-②: no and Metadata-protocol: none are line-initial in the body and the changeset, as claimed (6578598549, amended 6579908875). The changeset is patch for @object-ui/plugin-form.
  • Contract review: none owed (Clause-②: no; no export, prop, key or string change; the not-found copy is the existing RecordNotFoundState).
  • File surface: inside the claim and its amendment: ObjectForm.tsx, one JSDoc line in loadFailure.ts (approved before it was added), the new test, the changeset, and the control case of examples/schema-catalog/test/catalog-gallery-render.test.tsx (amendment 6579908875).
  • Read in the diff: SimpleObjectForm treats a null findOne answer as run.fail(new RecordNotFoundError(...)) and returns before seeding loadedRecordRef or the form, so no empty editable form and no Update button. The render arm draws RecordNotFoundState (simple-form-record-not-found) ahead of the generic error box, as ModalForm, DrawerForm, TabbedForm and WizardForm do since fix(plugin-form): the ?form overlay for a record that does not exist shows the not-found state, not an empty editable form #29246 and fix(plugin-form): drawer, tabbed and wizard edit forms for a record that does not exist show the not-found state, not an empty editable form #29351. A bus re-read that turns null takes the same path. Create and an existing record's edit are untouched.
  • Tests (dev): new pin 8 / 8; ablation (null check off) reds the 4 not-found cases with the controls green, restored to HEAD. plugin-form suite 222 files, 2,447 passed, 1 skipped. type-check and eslint clean. Derived gates 34 of 34, 0 NOT-MEASURED; 22 last measured at bde6a7f (later commits: a test cast and a main merge), 11 re-run at the final head.
  • Catalog pin (round 2): the first head red Test UI (9/16) at the objectui#6024 control, an edit of a record the fixture lacks, which this card turns into the not-found state by design. The control now spies findOne for its own id empty-record only (an empty record typed as a fixture row), restored in finally; both assertions and every other case are unchanged, and the JSDoc says why. At this head schema-catalog plus the plugin-form pin is 46 files, 2,440 / 2,440; type-check and eslint clean; 10 test and changeset gates re-run, exit 0 (report 6580272373).
  • Gates (check-runs on this head): 44 success, 11 skipped, 0 failed or pending. mergeable_state is clean.
  • Landing: ordinary queue landing, pr_ready then automerge_enable. Fixes #29354 closes the card on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 15:03
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 28f036f Nov 2, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-4d2jbw branch November 2, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ObjectForm (default layout): editing a record that does not exist opens a blank, editable form

1 participant